package com.google.code.sip.ucenter.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.google.code.sip.ucenter.dao.mongo.PasswordActionDaoImpl;
import com.google.code.sip.ucenter.model.ResetPasswordEvent;
import com.google.code.sip.ucenter.service.ResetPasswordEventManager;

@Service("resetPasswordEventManager")
public class ResetPasswordEventManagerImpl implements ResetPasswordEventManager {

	@Autowired
	private PasswordActionDaoImpl resetPasswordDao;

	@Override
	public ResetPasswordEvent get(String username, String password) {

		return resetPasswordDao.getByUser(username, password);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.google.code.sip.ucenter.service.ResetPasswordEventManager#save(com.google
	 * .code.ucenter.model.ResetPasswordEvent)
	 */
	@Override
	public void save(ResetPasswordEvent reset) {

		if (reset != null) {
			resetPasswordDao.save(reset);
		}
	}
}
